﻿@model CheckoutAttributeValueModel
@{
    Html.AddScriptParts("~/Scripts/farbtastic.js");
    Html.AddCssFileParts("~/Content/farbtastic/farbtastic.css");
}
@Html.ValidationSummary(false)
@Html.HiddenFor(model => model.Id)
@Html.HiddenFor(model => model.CheckoutAttributeId)
@Html.HiddenFor(model => model.DisplayColorSquaresRgb)

@if (ViewBag.RefreshPage == true)
{
    <script type="text/javascript">
        try {window.opener.document.forms['@(ViewBag.formId)'].@(ViewBag.btnId).click();}
        catch (e){} 
        window.close();
    </script>
}

@(Html.LocalizedEditor<CheckoutAttributeValueModel, CheckoutAttributeValueLocalizedModel>("checkoutattributevalue-localized",
@<table class="adminContent">
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.Locales[item].Name):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.Locales[item].Name)
            @Html.ValidationMessageFor(model => model.Locales[item].Name)
        </td>
    </tr>
    <tr>
        <td colspan="2">
            @Html.HiddenFor(model => model.Locales[item].LanguageId)
        </td>
    </tr>
</table>
,
@<table class="adminContent">
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.Name):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </td>
    </tr>
</table>
))
<table class="adminContent">
    @if (Model.DisplayColorSquaresRgb)
    {
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.ColorSquaresRgb):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.ColorSquaresRgb)
            <div id="color-picker"></div>
            <script  type="text/javascript">
                $(document).ready(function(){
                    $('#color-picker').farbtastic('#@Html.FieldIdFor(model => model.ColorSquaresRgb)');
                });
            </script>
            @Html.ValidationMessageFor(model => model.ColorSquaresRgb)
        </td>
    </tr>
    }
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.PriceAdjustment):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.PriceAdjustment) [@Model.PrimaryStoreCurrencyCode]
            @Html.ValidationMessageFor(model => model.PriceAdjustment)
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.WeightAdjustment):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.WeightAdjustment) [@Model.BaseWeightIn]
            @Html.ValidationMessageFor(model => model.WeightAdjustment)
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.IsPreSelected):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.IsPreSelected)
            @Html.ValidationMessageFor(model => model.IsPreSelected)
        </td>
    </tr>
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.DisplayOrder):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.DisplayOrder)
            @Html.ValidationMessageFor(model => model.DisplayOrder)
        </td>
    </tr>
</table>

